package org.lmind.scale.study

object Function {
  
  var c = 12

  def main(args: Array[String]) {
    
    call(1, 2, (a, b) => a + b)
    call(1, 2, sum)
    call(1, 2, {
      case (a:Int, b:Int) => a + b
      case _ => 0
    })
    fn3(1)(1)
  }
  
  def sum(a:Int, b:Int) = a + b
  
  def sum2(a:Int, b:Int) = {
    println(a + b)
    a + b
  }
  
  def fn3(a:Int)(b:Int) = a + b

  def call(a: Int, b: Int, fn: (Int, Int) => Int) =
    fn(a, b)
}